package com.qqbot.enums;

/**
 * @author 付亚全
 */
public enum DateIntervalTypeEnum {

    SECOND(1, 1000),
    MINUTES(2, 60 * 1000),
    HOUR(3, 60 * 60 * 1000),
    DATE(4, 24 * 60 * 60 * 1000),
    NONE(-1, 0);

    private int code;
    private long value;

    DateIntervalTypeEnum(int code, long value) {
        this.code = code;
        this.value = value;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public Long getValue() {
        return value;
    }

    public void setValue(Long value) {
        this.value = value;
    }

    public static DateIntervalTypeEnum find(int code) {
        for (DateIntervalTypeEnum dateIntervalTypeEnum : DateIntervalTypeEnum.values()) {
            if (code == dateIntervalTypeEnum.code) {
                return dateIntervalTypeEnum;
            }
        }
        return NONE;
    }
}
